package com.cxkj.shop.biz.commodity;

import java.util.Collection;
import java.util.Map;

import com.cxkj.shop.biz.AbstractShopBusiness;
import com.cxkj.shop.form.DefaultDeliveryBuilder;
import com.cxkj.shop.form.Delivery;
import com.cxkj.shop.form.DeliveryBuilder;
import com.cxkj.shop.utils.CommoditiesUtils;

public class LoadCommoditiesAllBusiness extends AbstractShopBusiness<Object>{

	@Override
	protected Delivery proce(Object input) throws Exception {
		Delivery res = null;
	    DeliveryBuilder<Collection<Map<String,Object>>> builder = DefaultDeliveryBuilder.getInstance();
	    try{
	      builder.init();
	      builder.setData(CommoditiesUtils.queryCommoditiesAll());
	      builder.success();
	    }catch(Exception e){
	      builder.fail();
	    }finally{
	      res = builder.toDelivery();
	      builder.clear();
	    }
	    return res;
	}

}
